package com.alarmclock_n18.server.listener;

import com.alarmclock_n18.server.entity.FailedReason;

import android.graphics.Bitmap;
import android.view.View;

public interface OnImageCallbackListener {
	 /**
     * callback function before get image, run on ui thread
     * 
     * @param imageUrl imageUrl
     * @param view view need the image
     */
    public void onPreGet(String imageUrl, View view);

    /**
     * callback function when get image but image not in cache, run on ui thread.<br/>
     * Will be called after {@link #onPreGet(String, View)}, before
     * {@link #onGetSuccess(String, String, View, boolean)} and
     * {@link #onGetFailed(String, String, View, FailedReason)}
     * 
     * @param imageUrl imageUrl
     * @param view view need the image
     */
    public void onGetNotInCache(String imageUrl, View view);

    /**
     * callback function after get image successfully, run on ui thread
     * 
     * @param imageUrl imageUrl
     * @param loadedImage loaded image bitmap
     * @param view view need the image
     * @param isInCache whether already in cache or got realtime
     */
    public void onGetSuccess(String imageUrl, Bitmap loadedImage, View view, boolean isInCache);

    /**
     * callback function after get image failed, run on ui thread
     * 
     * @param imageUrl imageUrl
     * @param loadedImage loaded image bitmap
     * @param view view need the image
     * @param failedReason failed reason for get image
     */
    public void onGetFailed(String imageUrl, Bitmap loadedImage, View view, FailedReason failedReason);
}
